package es.onlysolutions.gs.comm.facade;

import es.onlysolutions.arq.core.service.facade.GenericFacade;
import es.onlysolutions.gs.comm.entity.User;
import es.onlysolutions.gs.comm.dao.hb.UserHbDao;

/**
 * Facade for the user bussines operations.
 */
public class UserFacade extends GenericFacade
{

    private UserHbDao userHbDao;

    public void setUserHbDao(UserHbDao userHbDao)
    {
        this.userHbDao = userHbDao;
    }

    /**
     * Retrieve a user entity from the user login.
     * @param login The unique login.
     * @return The User entity.
     */
    public User getUserByLogin( String login )
    {
        return userHbDao.userByLogin( login );
    }

    /**
     * Check if the login currently are used by some user.
     * @param login The login to check.
     * @return true if some user use it.                          
     */
    public boolean getExistUser(String login)
    {
        User user = userHbDao.userByLogin( login );
        return user != null;
    }
}
